function reading = getSimulatedReadingSweep (simulatedRobot, map, angles)
        mapEdges = [map, circshift(map, [1, 0])];
        
        [numReadings, ignore] = size(angles);
        
        rays = [repmat(simulatedRobot(1:2), numReadings, 1), sin(angles), cos(angles)];
        result = ray_lineSegmentIntersect(rays, mapEdges);

        distanceMatrix = result.intNormalizedDistance1To2;
        % ensure that -inf doesn't mess up min
        distanceMatrix(~isfinite(distanceMatrix)) = NaN;
        % remove distances that don't intersect
        distanceMatrix(~result.intAdjacencyMatrix) = NaN;

        % minimum distance across rows
        reading = min(distanceMatrix, [], 2);
end